/**
 * Licensee: DuKe TeAm
 * License Type: Purchased
 */
package ormsamples;

import org.orm.*;
public class CreateTaller21Data {
	public void createTestData() throws PersistentException {
		PersistentTransaction t = orm.Taller21PersistentManager.instance().getSession().beginTransaction();
		try {
			orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
			orm.dao.PacienteDAO lormPacienteDAO = lDAOFactory.getPacienteDAO();
			orm.Paciente lormPaciente = lormPacienteDAO.createPaciente();
			// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : diagnostico
			lormPacienteDAO.save(lormPaciente);
			orm.dao.PrestacionDAO lormPrestacionDAO = lDAOFactory.getPrestacionDAO();
			orm.Prestacion lormPrestacion = lormPrestacionDAO.createPrestacion();
			// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : nombre
			lormPrestacionDAO.save(lormPrestacion);
			orm.dao.DiagnosticoDAO lormDiagnosticoDAO = lDAOFactory.getDiagnosticoDAO();
			orm.Diagnostico lormDiagnostico = lormDiagnosticoDAO.createDiagnostico();
			// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : pacientePa_id_paciente, descripcion
			lormDiagnosticoDAO.save(lormDiagnostico);
			t.commit();
		}
		catch (Exception e) {
			t.rollback();
		}
		
	}
	
	public static void main(String[] args) {
		try {
			CreateTaller21Data createTaller21Data = new CreateTaller21Data();
			try {
				createTaller21Data.createTestData();
			}
			finally {
				orm.Taller21PersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
